package com.jk.admin.service;

import com.jk.admin.dao.DiscountDao;
import com.jk.admin.entity.Coupon;
import com.jk.admin.entity.Discount;
import com.jk.admin.entity.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DiscountSerivce {

    @Autowired
    private DiscountDao dao;


    public List<Coupon> getListDis(Coupon discount) {
        List<Coupon> listDis = dao.getListDis(discount);
        return listDis;
    }
    public void delDis(String id) {
        dao.delDis(id);
    }
    public void updDis(Coupon discount) {
        if (discount.getCoupon_id()==null){
            dao.addDis(discount);
        }
        dao.updDis(discount);
    }
    public void addDis(Coupon discount) {
        dao.addDis(discount);
    }
    public Coupon huiDis(String id) {
        return  dao.huiDis(id);
    }


}
